import { Controller, Post, Req, Body } from '@nestjs/common';
import { ApiBearerAuth } from '@nestjs/swagger';
import { Auth } from 'src/common/decorators/auth.decorator';
import { RequirePermission } from 'src/common/decorators/permission.decorator';
import { CreateStageDto } from 'src/modules/stage/dto/create-stage.dto';
import { StageCreateService } from './stage-create.service';

@Auth()
@ApiBearerAuth()
@Controller('stage')
export class StageCreateController {
  constructor(private readonly stageCreateService: StageCreateService) {}
  @RequirePermission('1003002')
  @Post('stageCreate')
  async create(@Req() request, @Body() createStageDto: CreateStageDto) {
    const user = request.user;
    createStageDto.createBy = user.id;
    createStageDto.updateBy = user.id;
    return await this.stageCreateService.create(createStageDto);
  }
}
